package com.jml.api.service.impl;

import com.jml.api.entity.UserEntity;
import com.jml.api.service.IMemberService;
import com.jml.base.BaseApiService;
import com.jml.base.ResponseBase;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class MemberServiceImpl extends BaseApiService implements IMemberService {
	@Value("${server.port}")
	private String serverPort;

	@RequestMapping("/getMember")
	public UserEntity getMember(@RequestParam("name") String name) {
		UserEntity userEntity = new UserEntity();
		userEntity.setName(name + "端口号:" + serverPort);
		userEntity.setAge(20);
		System.out.println(serverPort);
		return userEntity;
	}

	@RequestMapping("/getUserInfo")
	public ResponseBase getUserInfo() {
		System.out.println(" 我是会员服务,会员服务调用订单服务开始啦！！");
		try {
			// 会员服务接口产生1.5秒的延迟
			Thread.sleep(1500);
		} catch (Exception e) {
		}
		return setResultSuccess("订单服务接口调用会员服务接口成功....");
	}

}
